home *** CD-ROM | disk | FTP | other *** search
Text File | 1993-08-27 | 3.1 KB | 57 lines | [TEXT/KAHL] |
- /*****************************************************************************************************
- * *
- * Finder ProgressBar.h - Copyright 1993 Chris Larson (cklarson@engr.ucdavis.edu) All rights reserved *
- * *
- * This is the header file for a CDEF which mimics the progress bar used by the Finder. This file and *
- * compiled derivatives may be freely used within any freeware/shareware/postcardware/beerware/… as *
- * long as you mention my name in your credits. Neither this source nor its compiled derivatives are *
- * in the public domain and may not be use in any form in public domain software. Neither this source *
- * nor its compiled derivatives may be used in any form in a commercial product without the expressed,*
- * written consent of the author (me). *
- * *
- * Version 1.0 -- Initial Release. *
- * *
- *****************************************************************************************************/
-
- // Constants
-
- #define kNoColorQD 0x4000 // If this bit in ROM85 is set, color QD is not available.
-
- #define cGray { 0x4444, 0x4444, 0x4444 } // Color of bar itself.
- #define cBlue { 0xCCCC, 0xCCCC, 0xFFFF } // Color of space bar fills.
- #define cBlack { 0x0000, 0x0000, 0x0000 } // Frame color and color-mapping background.
- #define cWhite { 0xFFFF, 0xFFFF, 0xFFFF } // Color-mapping background.
-
- // Inline Functions (NOTE: These routines are _not_ general. They work here only. Don't use them
- // elsewhere unless you understand thier limitations)
-
- void MySetUpA4(void)
- = {
- 0x2F0C, // MOVE.L A4,-(A7) ; Push A4
- 0x2848 // MOVEA.L A0,A4 ; Make A4 point to the code resource
- };
-
- void MyRestoreA4(void)
- = {
- 0x285F // MOVE.L (A7)+,A4 ; Pop A4
- };
-
- #pragma parameter __D0 CalcBarBoundry (__A1, __A0)
- short CalcBarBoundry (Rect *theBox, ControlPtr theControl)
- = {
- 0x3029, 0x0002, // MOVE.W $0002(A1),D0 ; rect left edge to d0
- 0x3229, 0x0006, // MOVE.W $0006(A1),D1 ; rect right edge to d1
- 0x9240, // SUB.W D0,D1 ; rect width to d1
- 0x3428, 0x0016, // MOVE.W $0016(A0),D2 ; control max to d2
- 0x9468, 0x0014, // SUB.W $0014(A0),D2 ; control range to d2
- 0x6708, // BEQ.S *+$000A ; if range==0, exit to avoid divide by 0
- 0xC2E8, 0x0012, // MULU.W $0012(A0),D1 ; width*value to d1 (32 bit product)
- 0x82C2, // DIVU.W D2,D1 ; (width*value)/range to d1 (16 bit quotient)
- 0xD041 // ADD.W D1,D0 ; offset by left edge of rect
- };
-
- // Function Prototypes
-
- pascal long main (short varCode, ControlHandle theControlHandle, short message, long param);
- void DrawProgressBar (ControlHandle theControlHandle);
-